home *** CD-ROM | disk | FTP | other *** search
- global lineNum
- global indexText
- global masterList
-
- on SpinToNextWorkshop
- repeat while char 1 of line lineNum of indexText <> "ΓÇó" and lineNum < the number of lines in indexText
- set lineNum to lineNum + 1
- end repeat
- end
-
- on ParseIndex
- set the itemdelimiter to ";"
-
- OpenXtras
-
- set indexText to ReadTextFile( the MoviePath &"Index Text" )
-
- set MasterList to [:]
-
- set linenum to 1
- repeat while true
- SpinToNextWorkshop
-
- if lineNum >= the number of lines in indexText then exit repeat
-
- set theWorkshopID to char 2 to 4 of line lineNum of indexText
-
- set lineNum to lineNum + 1
- set theTeachMeID to line lineNum of indexText
-
- set theWorkshopID to UpShift( theWorkshopID )
- set theTeachMeID to UpShift( theTeachMeID )
-
- put "Workshop" && theWorkshopID && "TeachMe ID" && theTeachMeID && the freebytes
- set lineNum to lineNum + 1
- set thisLine to line lineNum of indexText
- repeat with i = 1 to the number of items in thisLine
- set thisKeyPhrase to item i of thisLine
- repeat while char 1 of thisKeyPhrase = " "
- delete char 1 of thisKeyPhrase
- end repeat
- --put thisKeyPhrase
-
- if thisKeyPhrase contains QUOTE then
- put "Quote in keyphrase" && thisKeyPhrase
- end if
- if thisKeyPhrase contains TAB then
- put "Tab in keyphrase" && thisKeyPhrase
- end if
- if thisKeyPhrase contains RETURN then
- put "Return in keyphrase" && thisKeyPhrase
- end if
-
- --set thisKeyPhrase to UpShift( thisKeyPhrase )
-
- set foundKeyValue to getaprop( masterlist, thisKeyPhrase )
-
- if theTeachMeID = "none" then
- set TeachMeList to [ ]
- else
- set TeachMeList to [ theTeachMeID ]
- end if
- set WorkshopList to [:]
-
- if voidp(foundKeyValue) then
- -- keyphrase is not in list
- AddProp( WorkshopList, theWorkshopID, TeachMeList )
- addprop( masterlist, thisKeyPhrase, WorkshopList )
- else
- -- key phrase is in list
- --put thisKeyPhrase && "in the list" && foundKeyValue
- set foundTeachMeList to getaprop( foundKeyValue, theWorkshopID )
- if voidp(foundTeachMeList) then
- --put "adding workshop to keyphrase" && theWorkshopID && TeachMeList
- AddProp( foundKeyValue, theWorkshopID, TeachMeList )
- else
- add( foundTeachMeList, theTeachMeID )
- --put "need to add teachme ID to workshop list" && theWorkshopID && theTeachMeID
- end if
- end if
- end repeat
- end repeat
- sort ( MasterList )
- put listp( value( string( masterlist ) ) )
- set theLength to the number of chars of string(MasterList)
- set the text of cast "Master1" of castlib "Find" to char 1 to 30000 of string(MasterList)
- set the text of cast "Master2" of castlib "Find" to char 30001 to theLength of string(MasterList)
-
-
- set keywords to ""
- repeat with i = 1 to count( MasterList )
- set thisKeyPhrase to getpropat( masterlist, i )
- put thisKeyPhrase & RETURN after keywords
- end repeat
- set the text of cast "Topics" of castlib "Shared" to keywords
- end
-
- on FixWorkshopLongNames
- OpenXtras
- set longnamelist to [:]
- set oldLongNameList to value(the text of cast "longnames" of castlib "find")
- repeat with i = 1 to count( oldLongNameList )
- set thisPageShortName to getpropat(oldLongNameList, i)
- set thisPageShortName to UpShift( thisPageShortName )
- addprop( longnamelist, thisPageShortName, getat( oldLongNameList, i ) )
- end repeat
- put longnamelist
- set the text of cast "longnames" of castlib "find" to string( longNameList )
- end
-